<?php
header("Content-type:text/html;charset=utf-8");
//要比对数据，首先要去数据库取出数据
 $db = include 'db_zhuce.php';

 // var_dump($_POST);

//$email = $_POST['email'];

//判断登录信息是否合法
if(!empty($_POST)){
	$username = $_POST['username'];
    $password = $_POST['password'];
	//判断登录成功走这里
	foreach ($db as $key => $value) {		
		if($username==$value['username'] && $password==$value['password']){
			session_start();
            $_SESSION['username'] = $_POST['username'];
            $_SESSION['password'] = $_POST['password'];
			echo '登录成功';
			header('Location:index.php');
		}
	}

	echo '账号或密码错误';

}else{
   include './Tpl/login.html'; //不成功走模板，重新登录
   
}















